/*
 * interrupt_trap_handler.h
 *
 *  Created on: May 27, 2013
 *      Author: Aden
 */
#ifndef INTERRUPT_TRAP_HANDLER_H_
#define INTERRUPT_TRAP_HANDLER_H_

#include "global.h"
#include "pcb.h"
#include "cpu.h"

/*
 * Trap/Interrupt function call prototypes.
 * These must have the same number of arguments in order for the current set up to work.
 * It is okay for arguments that are not used.
 * These are the kernel mode handlers.
 */
int timer_int_handler(PCBPtr* process, int counter);
int io_int_handler(PCBPtr* process, int counter);
int io_kybd_handler(PCBPtr* process, int counter);

int io_req_trap_handler(PCBPtr* process, int counter);
int mutex_lock_trap_handler(PCBPtr* process, int counter);
int mutex_unlock_trap_handler(PCBPtr* process, int counter);
int cond_wait_trap_handler(PCBPtr* process, int counter);
int cond_signal_trap_handler(PCBPtr* process, int counter);

//Ideally I want this here so that the interrupt handler is talking to it.

pthread_mutex_t pending_interrupts_lock;
QueuePtr pending_interrupts;

#endif /* INTERRUPT_TRAP_HANDLER_H_ */
